package com.example.mapp;

import com.example.entity.authority.PartyContractProject;
import com.example.mapp.buildSql.PartyContractProjectMappSql;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface PartyContractProjectMapp {

    @Insert("INSERT INTO party_contract_project (contract_id, elevator_count, elevator_ids, one_price, project_address, project_name, end_time, star_time, project_area, project_city, project_province) VALUES(#{contractId},#{elevatorCount},#{elevatorIds},#{onePrice},#{projectAddress},#{projectName},#{endTime},#{starTime}," +
            "#{projectArea},#{projectCity},#{projectProvince})")
    @SelectKey(statement="select last_insert_id()",keyProperty = "id",keyColumn = "id",before = false,resultType = Long.class)
    int insert(PartyContractProject partyContract) throws Exception;


    @Select(" select * from party_contract_project where contract_id = #{contractId}")
    List<PartyContractProject> queryByContractId(String contractId) throws Exception;

    @Delete(" delete from party_contract_project where id =#{id}")
    int delete(String id)throws Exception;

    @Select(" select * from party_contract_project where id = #{id}")
    PartyContractProject queryById(String id);

    /**
     * 更新合同项目
     * @param partyContract
     */
    @UpdateProvider(type = PartyContractProjectMappSql.class, method = "updateContractProject")
    void updateProject(PartyContractProject partyContract);

}
